package main

import "fmt"

func main() {

	var html string = `
	<!doctype html>
<html lang="zh"> 
 <head> 
  <meta charset="UTF-8"> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
  <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
  <title>HServer-API</title> <!-- 最新版本的 Bootstrap 核心 CSS 文件 --> 
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- 可选的 Bootstrap 主题文件（一般不用引入） --> 
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> <!-- 最新的 Bootstrap 核心 JavaScript 文件 --> 
  <style type="text/css">
    .header {
      text-align: center;
      line-height: 30px;
    }

    .demo {
      padding: 2em 0;
      background: #fff;
    }

    a:hover,
    a:focus {
      text-decoration: none;
      outline: none;
    }

    #accordion .panel {
      border: none;
      box-shadow: none;
      border-radius: 0;
      margin: 0 0 15px 10px;
    }

    #accordion .panel-heading {
      padding: 0;
      border-radius: 30px;
    }

    #accordion .panel-title a {
      display: block;
      padding: 12px 20px 12px 50px;
      background: #ebb710;
      font-size: 18px;
      font-weight: 600;
      color: #fff;
      border: 1px solid transparent;
      border-radius: 30px;
      position: relative;
      transition: all 0.3s ease 0s;
    }

    #accordion .panel-title a.collapsed {
      background: #fff;
      color: #0d345d;
      border: 1px solid #ddd;
    }

    #accordion .panel-title a:after,
    #accordion .panel-title a.collapsed:after {
      content: "";
      font-family: fontawesome;
      width: 55px;
      height: 55px;
      line-height: 55px;
      border-radius: 50%;
      background: #ebb710;
      font-size: 25px;
      color: #fff;
      text-align: center;
      border: 1px solid transparent;
      box-shadow: 0 3px 10px rgba(0, 0, 0, 0.58);
      position: absolute;
      top: -5px;
      left: -20px;
      transition: all 0.3s ease 0s;
    }

    #accordion .panel-title a.collapsed:after {
      content: "";
      background: #fff;
      color: #0d345d;
      border: 1px solid #ddd;
      box-shadow: none;
    }

    #accordion .panel-body {
      padding: 0px 25px 10px 9px;
      background: transparent;
      font-size: 14px;
      color: #8c8c8c;
      line-height: 25px;
      border-top: none;
      position: relative;
    }

    #accordion .panel-body:nth-child(1) {
      padding: 20px 25px 10px 9px;
      background: transparent;
      font-size: 14px;
      color: #8c8c8c;
      line-height: 25px;
      border-top: none;
      position: relative;
    }

    #accordion .panel-body p {
      padding-left: 25px;
      border-left: 1px dashed #8c8c8c;
    }

  </style> 
 </head> 
 <body> 
  <header class="header"> 
   <h2>API文档 </h2> 
  </header> 
  <div class="demo"> 
   <div class="container"> 
    <div class="row"> 
     <div class=" col-md-12"> 
      <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> 
       <div class="panel panel-default"> 
        <div class="panel-heading" role="tab" id="headingThree0"> 
         <h4 class="panel-title"> <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree0" aria-expanded="false" aria-controls="collapseThree0"> API </a> </h4> 
        </div> 
        <div id="collapseThree0" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree0"> 
         <div class="panel-body"> 
          <div class="panel"> 
           <div class="panel-heading"> 
            <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#" href="#four华夏生成0"> 华夏生成 </a> </h4> 
           </div> 
           <div id="four华夏生成0" class="panel-collapse collapse in"> 
            <div class="panel-body"> 
             <div class="api-sub-content"> 
              <div class="simpleline">
               <strong>接口地址：</strong><span class="url"> /api/hx/gen</span>
              </div> 
              <div class="simpleline">
               <strong>请求方式：</strong><span class="url"> GET POST </span>
              </div> 
              <div class="simpleline">
               <strong>描述：</strong><span class="url"> <br>测试地址：<a href="http://apihuaxia.t1f.cn/api/hx/gen?phone=15228311111&amp;flag=1001" target="_blank">http://apihuaxia.t1f.cn/api/hx/gen?phone=15228311111&amp;flag=1001</a><br>成功：<br>&nbsp;&nbsp; type不传时， 重定向跳转到一个网页<br>&nbsp;&nbsp; type为json时，{"code":200,"msg":"操作成功","url":"https://xxxxxxxxxx"}<br>失败：{“code”:-1,”msg”:”错误原因”} </span>
              </div> 
             </div> 
             <div class="simpleTable"> 
              <table class="table table-bordered"> 
               <caption>
                请求参数说明：
               </caption> 
               <thead> 
                <tr class="title"> 
                 <th width="100">名称</th> 
                 <th width="60">必填</th> 
                 <th width="80">类型</th> 
                 <th>说明</th> 
                </tr> 
               </thead> 
               <tbody> 
                <tr> 
                 <td class="url">phone</td> 
                 <td class="url"> 是 </td> 
                 <td class="url">String</td> 
                 <td>手机号或者11位自定义编码</td> 
                </tr> 
                <tr> 
                 <td class="url">flag</td> 
                 <td class="url"> 是 </td> 
                 <td class="url">String</td> 
                 <td>标识</td> 
                </tr> 
                <tr> 
                 <td class="url">type</td> 
                 <td class="url"> 否 </td> 
                 <td class="url">String</td> 
                 <td>响应类型 json或者不传</td> 
                </tr> 
               </tbody> 
              </table> 
             </div> 
            </div> 
           </div> 
          </div> 
         </div> 
         <div class="panel-body"> 
          <div class="panel"> 
           <div class="panel-heading"> 
            <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#" href="#four回调测试1"> 回调测试 </a> </h4> 
           </div> 
           <div id="four回调测试1" class="panel-collapse collapse in"> 
            <div class="panel-body"> 
             <div class="api-sub-content"> 
              <div class="simpleline">
               <strong>接口地址：</strong><span class="url"> /api/hx/testCallBack</span>
              </div> 
              <div class="simpleline">
               <strong>请求方式：</strong><span class="url"> GET POST </span>
              </div> 
              <div class="simpleline">
               <strong>描述：</strong><span class="url"> <br>传入测试phone或者11位自定义编码，进行回调测试<br>进件状态和核卡都会回调，需要商家提供回调地址.<br>回调方法：POST<br>回调数据说明：<br>{"phone":"手机号或者11位自定义编码","flag":"渠道标识","cjState":"进件状态","chState":"核卡状态","createTime":创建时间搓,"cjTime":进件时间搓,"chTime":核卡时间搓}<br>回调参数加密说明：参数使用RC4加密,解密需要使用渠道标识解密</span>
              </div> 
             </div> 
             <div class="simpleTable"> 
              <table class="table table-bordered"> 
               <caption>
                请求参数说明：
               </caption> 
               <thead> 
                <tr class="title"> 
                 <th width="100">名称</th> 
                 <th width="60">必填</th> 
                 <th width="80">类型</th> 
                 <th>说明</th> 
                </tr> 
               </thead> 
               <tbody> 
                <tr> 
                 <td class="url">phone</td> 
                 <td class="url"> 是 </td> 
                 <td class="url">String</td> 
                 <td>手机号或者11位自定义编码</td> 
                </tr> 
               </tbody> 
              </table> 
             </div> 
            </div> 
           </div> 
          </div> 
         </div> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
   </div> 
  </div> 
  <script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.js"></script> 
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>  
 </body>
</html>
`
	doc := make(map[string][]string)
	for i := 0; i < len(html); i++ {
		// 60==> "<" 提取 节点名字 <*>  <*/>
		if html[i] == 60 && html[i+1] != 47 {
			//向后查询不为空格的 就是 node 节点
			for j := i; j < len(html); j++ {
				// 32or62 ==> "空or>"
				if html[j] == 32 || html[j] == 62 {
					var s2 []string
					doc[html[i+1:j]] = s2
					break
				}
			}
		}
	}
	for country := range doc {
		fmt.Println(country)
	}

}
